BeginNum=true;
function getUrlParam(name) {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
	var r = window.location.search.substr(1).match(reg);
	if (r != null)
		return decodeURI(r[2]);
	return null;
}

function dataAjax(){
	var userId=getUrlParam('userId');
	var year=getUrlParam('year');
	var month=getUrlParam('month');
	var day=getUrlParam('day');
	$(".time_details").html(year+'年'+month+'月'+day+'日');
//	var userId="DT1200379";			
//	alert();
	var str="{'userId':'"+userId+"'}";
	str = Base64.encode(str);
	//请求数据；
	jQuery(function(){
				jQuery.ajax({
					url:roll_index,
					type:"post",
					dataType:"text",
					data:{commonURL:roll_index,'param':str,'opName':'get_regorder_list',"osFlag":'5'},
					async:false,
					success:function(serverinfo){
						//alert("success");
//						console.log(serverinfo);
						var Data=decodeURI(Base64.decode(serverinfo));
							Data=JSON.parse(Data);
							console.log(Data);
							console.log(Data.itemList);//itemList
							if(Data.itemList&&Data.itemList.length>0)//数据存在并且长度大于0.glyphicon-volume-up							
							{
								var $Ulhtml=$("<ul></ul>");
								for(var i=0;i<Data.itemList.length;i++){
									if(Data.itemList[i].time&&Data.itemList[i].time!="")//每条消息的时间是否存在；
									{
										var $laba=$("<img src='../img/normal.png' class='play'/>");
										var $Lihtml=$("<li><span style='color:#666;'>"+Data.itemList[i].time+"&nbsp;</span>"+Data.itemList[i].title+"</li>");
										$Lihtml.append($laba);
										if(Data.itemList[i].bigFlag==0){
											var $sp=$("<span class='prompt'style='border-right:0.86rem solid #f3721f;'><i class='trigon_inner'>大单</i></span>");//
											$Lihtml.append($sp);
											$Lihtml.css({"color":"#f3721f"});
											//$laba.css({"color":"darkorange"});
											$laba.attr("src","../img/big.png");
										}else if(Data.itemList[i].keyFlag==0){
											var $sp=$("<span class='prompt'><i class='trigon_inner'>重点</i></span>");//
											$Lihtml.append($sp);
											$Lihtml.css({"color":"#df4b3c"});
											//$laba.css({"color":"red"});
											$laba.attr("src","../img/important.png");
										}
										$Ulhtml.append($Lihtml);
									}else{
										var $laba=$("<img src='../img/normal.png' class='play'/>");
										var $Lihtml=$("<li>"+Data.itemList[i].title+"</li>");
										$Lihtml.append($laba);
										if(Data.itemList[i].bigFlag==0){
											var $sp=$("<span class='prompt'style='border-right:0.86rem solid #f3721f;'><i class='trigon_inner'>大单</i></span>");//
											$Lihtml.append($sp);
											$Lihtml.css({"color":"#f3721f"});
											//$laba.css({"color":"darkorange"});
											$laba.attr("src","../img/big.png");
										}else if(Data.itemList[i].keyFlag==0){
											var $sp=$("<span class='prompt'><i class='trigon_inner'>重点</i></span>");//
											$Lihtml.append($sp);
											$Lihtml.css({"color":"#df4b3c"});
											//$laba.css({"color":"red"});
											$laba.attr("src","../img/important.png");
										}
										$Ulhtml.append($Lihtml);
									}
									
								}
								$("#demo1").append($Ulhtml);
								var UlHeight=$Ulhtml.height();
								var Wheight=$(window).height();
		//						var headHeight=$("header").height();
								var Height=parseInt(Wheight-43);							
								$("#demo").css({"height":Height});
								//判断是否滚动；
								if(false){//UlHeight-Height>0
									var demo = document.getElementById("demo");
		    						var demo1 = document.getElementById("demo1");
								    var demo2 = document.getElementById("demo2");
								    var speed=30;    //滚动速度值，值越大速度越慢
						   	 
   	
   	
							   	//判断是否滚动；
							    demo2.innerHTML = "<div style='width:100%;text-align:center;line-height:0.8rem;color:#dcdcdc;font-size:0.28rem;'>1、2、3、4，再来一次~~</div>"+demo1.innerHTML    //克隆demo2为demo1；
						        function Marquee(){
							        if(demo2.offsetTop-demo.scrollTop<=0)    //当滚动至demo1与demo2交界时
							            demo.scrollTop -= demo1.offsetHeight    //demo跳到最顶端
							        else{
							            demo.scrollTop ++     //如果是横向的 将 所有的 height top 改成 width left
							        }
							    };
							    MyMar = setInterval(Marquee,speed);        //设置定时器
							   
							    demo.addEventListener("touchstart",StopFn,false);//点击容器停止滚动
							    //停止滚动的方法
								function StopFn(){
									console.log("stop");
									clearInterval(MyMar);
									if(BeginNum){
										BeginNum=false;
										//开启手动滑动；
//										$("#demo2").hide();
										$("#demo").css({"overflow":"auto","overflow-x":"hidden","position":"abosolute"});
										
										
										setTimeout(function(){
											//开启自动滚动
											$("#demo2").show();
											$("#demo").css({"height":Height,"overflow":"hidden"});//样式需要
											
											clearInterval(MyMar);
											MyMar = setInterval(Marquee,speed);
											BeginNum=true;	
										},2000);
									}
								};//结束
							}//滚动设置结束
						}//数据操作结束
					},
					error:function(){
											
					}
				});
			});
}


